from django.db import models


class Area(models.Model):
    name = models.CharField(max_length=32)
    # 进行自关联
    parent = models.ForeignKey('self', null=True, blank=True, related_name='subs', on_delete=models.CASCADE)

    class Meta:
        db_table = 'tb_areas'
        verbose_name = '中国地名'
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.name
